package com.xzx.annotation.custom;

import com.xzx.annotation.bean.Person06;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author xinzhixuan
 * @version 1.0
 * @date 2025/4/18 17:50
 */
@Slf4j
@Component
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof Person06) {
            log.info("=====BeanPostProcessor postProcessBeforeInitialization==");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof Person06) {
            log.info("=====BeanPostProcessor postProcessAfterInitialization");
        }
        return bean;
    }
}
